
#include "graphicsmanager.h"

#include "primitives.h"
#include <gl/glew.h>
#include <vector>
#include <cmath>

void GraphicsManager::DrawLine( float x1,float y1,float x2,float y2, float width )
{
	lineCool(x1,y1,x2,y2,width);
}

void GraphicsManager::circle( float x1, float y1, float radi )
{
	std::vector<float> verts;
	int segs = 36;
	for(int i=0; i<segs; i++)
	{
		float ang = (float)i * 2*3.14159f/(segs-1);
		float x = x1 + cos(ang)*radi;
		float y = y1 + sin(ang)*radi;

		verts.push_back(x);
		verts.push_back(y);

		ang = (float)(i+1) * 2*3.14159f/(segs-1);
		x = x1 + cos(ang)*radi;
		y = y1 + sin(ang)*radi;
		verts.push_back(x);
		verts.push_back(y);
	}

	glEnableClientState(GL_VERTEX_ARRAY);
	glVertexPointer(2,GL_FLOAT,0,&verts[0]);
	glDrawArrays(GL_LINES, 0, verts.size() );
	glDisableClientState(GL_VERTEX_ARRAY);
}
